package com.diaohw.module.log.controller;


import com.diaohw.module.log.obj.entity.DbLog;
import com.diaohw.module.log.obj.entity.RequestLog;
import com.diaohw.module.log.obj.query.LogQuery;
import com.diaohw.module.log.service.LogService;
import com.diaohw.platform.common.obj.page.PageResultVo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/log")
@Tag(name = "日志操作")
public class LogController {
    @Resource
    private LogService logService;

    @Operation(summary = "http日志查询")
    @GetMapping("/request")
    public PageResultVo<RequestLog> httpList(LogQuery query) {
        return logService.httpList(query);
    }

    @Operation(summary = "DB日志查询")
    @GetMapping("/db")
    public PageResultVo<DbLog> dbList(LogQuery query) {
        return logService.dbList(query);
    }

    @DeleteMapping("/request")
    @Operation(summary = "删除日志")
    public Boolean deleteRequestLog(@RequestBody LogQuery query) {
        return logService.deleteRequestLog(query);
    }

    @DeleteMapping
    @Operation(summary = "批量删除日志")
    public Boolean deleteRequestLog(@RequestBody List<String> logIds) {
        return logService.deleteRequestLog(logIds);
    }
}
